package top.sqdpt.rag.assistant;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import top.sqdpt.rag.service.AiChatService;

@Component
public class RagLoader implements ApplicationRunner {

    @Autowired
    private AiChatService aiChatService;

    @Value("aichat.rag.path")
    private String fileDir;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        if (StringUtils.hasText(fileDir)) {
            aiChatService.loadDocByDir(fileDir);
        }
    }


}
